/**
 * @author zhounan 
 * @date 2024年5月31日
 * @version V1.0
 */
package org.zn.etl.misc;

import java.io.IOException;
import java.io.InputStream;

import org.springframework.core.io.ClassPathResource;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.ParserContext;
import org.springframework.expression.common.TemplateParserContext;
import org.springframework.expression.spel.standard.SpelExpressionParser;

/**
 * @author zhounan 
 * @date 2024年5月31日
 * @version V1.0
 */
public class JobDocBuilder {

	
	private ExpressionParser  parser= new SpelExpressionParser();
	private ParserContext parserContext =new TemplateParserContext("${","}");
	private String template;
	
	
	public static String  wappedBody(String doc) {
		
		StringBuilder sb=new StringBuilder();
		
		sb.append("<!DOCTYPE html><html><body>");
		sb.append(doc);
		
		sb.append("</body></html>");
		return sb.toString();
	} 
	
	
	public void load(String path) throws IOException {
		
		ClassPathResource res=new ClassPathResource(path); 
		
		InputStream is= res.getInputStream();
		
		byte[] bys=new byte[is.available()];
		
		is.read(bys);
		
		template=new String(bys);
		is.close();
		
	}
	
	
	public static void main(String[] args) throws IOException {
		
		JobDocBuilder jb=new JobDocBuilder();
		
		jb.load("/html/job.html");
		
		System.out.println(jb.template);
		
		 
	}
	
	
}
